-- ======================================================================
-- Hell Lua Bus
-- 
-- Copyright 2012-2013Hell-Prototypes
--
-- http://www.hellprototypes.com/
--
-- This is free software, licensed under the terms of the GNU General
-- Public License as published by the Free Software Foundation.
-- ======================================================================
hlb = require('libhlb')

function device_open()
	local ret = hlb.usb_open()
	if ret < 0 then
		print("Fail to open usb device")
		return false
	end
	
	return true
end

function device_close()
	local ret = hlb.usb_close()
	if ret < 0 then
		print("Fail to close usb device")
		return false
	end
	
	return true
end
-- -----------------------------------------------

device_open()

ret = hlb.ctrl_12V(1)
print("ret1 = " .. ret)

io.write("\r\nAny key to continue ...")
io.flush()
io.read()
print("")

ret = hlb.ctrl_12V(0)
print("ret2 = " .. ret)

device_close()
